home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15436 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: netnews.upenn.edu!dsinc!ub!newserve!rebecca!rpi!not-for-mail
  2. From: Tony Confrey <ac11@gte.com>
  3. Newsgroups: comp.lang.c++,comp.lang.c++.moderated,comp.object
  4. Subject: C++ objects in shared memory
  5. Date: 5 Apr 1996 00:16:10 -0000
  6. Organization: GTE Labs
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: herbs@connobj.com
  9. Message-ID: <4k1ooa$lru@netlab.cs.rpi.edu>
  10. NNTP-Posting-Host: netlab.cs.rpi.edu
  11. X-Original-Date: Tue, 02 Apr 1996 15:54:08 -0500
  12.  
  13. Apologies if you've already seen this, I'm unclear if my newsreader
  14. is set up correctly.
  15.  
  16. I am trying to store instances of C++ objects in shared memory so 
  17. that their function and data members can be accessed by multiple
  18. processes running on the same unix box.
  19.  
  20. Storing the instance in shared memory is no problem - I've been using
  21. placement new with a previously allocated block of shared memory that
  22. all processes connect to. Calling member functions, in particular 
  23. virtual member functions, is more difficult.
  24.  
  25. I'm finding (actually more like deducing) the following: If process 
  26. A creates an instance then the vtbl points to function addresses in
  27. process A's address space. Calling non virtual functions or 
  28. accessing data members from another process, B, works fine. 
  29. However calling virtual functions from B segv's because its 
  30. trying to call outside its address space. 
  31.  
  32. For a while it looked like linking the class library as a shared library
  33. would work - in fact it does under aix - because the functions end up in 
  34. the same place in memory. However under solaris the address spaces are
  35. mapped differently.
  36.  
  37. Any suggestion would be appreciated. Can this be done? Is there some
  38. other approach I should take? I find it hard to believe that no 
  39. one has ever tried such a thing.
  40.  
  41. Thanks
  42.  
  43. Tony
  44.  
  45.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  46.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  47.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  48.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  49.